package com.example.controller;


import com.example.service.TileReqService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/tile")
public class TileController {

    @Autowired
    private TileReqService tileReqService;

    @GetMapping("response")
    public byte[] getTileReqStream(@RequestParam("x") String x, @RequestParam("y") String y,
                                   @RequestParam("z") String z) {
        x = x.replace(".pbf", "");
        y = y.replace(".pbf", "");
        z = z.replace(".pbf", "");
        //原始流数据
        byte[] b1 = tileReqService.getTileReqStream(x, y, z);
        return b1;
    }

}
